package com.sunlong.jiangwei.dao;

import com.sunlong.jiangwei.entity.JwSku;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 孙龙
 * @since 2021-02-19
 */
public interface JwSkuMapper extends Mapper<JwSku> {

    @Select("select * from jw_sku where spu_id = #{spuId} and sku_own_spec = #{skuOwnSpec}")
    JwSku selectbySpubIdAndSkuOwnSpec(Long spuId, String skuOwnSpec);

    @Update("update jw_sku set sku_images = #{uploadUrl} where sku_id = #{skuId}")
    void updateImageUrlById(@Param("skuId") Long skuId, @Param("uploadUrl") String uploadUrl);

    @Select("select * from jw_sku where spu_id = #{spuId}")
    List<JwSku> selectBySpuId(Long spuId);
}
